<%-- 
    Document   : Dbtest
    Created on : Apr 27, 2008, 9:49:01 PM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h2>test Oracle</h2>
        <% 
            // connection driver for database
            //Class.forName("com.mysql.jdbc.Driver").newInstance(); 
            //                                                 // Database URL/database username password
            //Connection con=java.sql.DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/airline","root","123456"); 
            
            
            Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); 
            String url = "jdbc:oracle:thin:@db.student.chalmers.se:1521:kingu";
            String user = "dat135_013";
            String password = "dat135_013";
            Connection connection = DriverManager.getConnection(url, user, password);
            
            
            
            Statement stmt=connection.createStatement(); 
            ResultSet rst=stmt.executeQuery("select * from test"); 
            while(rst.next()) 
            { 
            out.print(rst.getString("name"));
            out.print("  ");
            out.print(rst.getString("address"));
            out.print("<br>");
            } 
            rst.close(); 
            stmt.close(); 
            connection.close(); 
        %>
    </body>
</html>
